package com.xxxx.server.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.xxxx.server.pojo.College;
import com.xxxx.server.pojo.RespPageBean;
import com.xxxx.server.pojo.Tclass;
import com.xxxx.server.mapper.TclassMapper;
import com.xxxx.server.service.ITclassService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 班级表 服务实现类
 * </p>
 *
 * @author zhoubin
 * @since 2022-04-23
 */
@Service
public class TclassServiceImpl extends ServiceImpl<TclassMapper, Tclass> implements ITclassService {

    @Autowired
    private TclassMapper tclassMapper;

    @Override
    public RespPageBean getTclassByPage(Integer currentPage, Integer size, Tclass tclass,int roleid,int collegeid) {
        //开启分页
        Page<Tclass> page = new Page<>(currentPage,size);
        IPage<Tclass> tclassByPage = tclassMapper.getTclassByPage(page,tclass,roleid,collegeid);
        RespPageBean respPageBean = new RespPageBean(tclassByPage.getTotal(), tclassByPage.getRecords());
        return respPageBean;

    }

}
